package com.internship.javawebinternship.repository;

import com.internship.javawebinternship.entity.TutorInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface TutorInfoRepository extends JpaRepository<TutorInfo, String> {

    @Transactional(rollbackFor = Exception.class)
    @Modifying
    @Query(value = "select * from covid19.tutor_info where if(?1 !='',college=?1,1=1)", nativeQuery = true)
    public List<TutorInfo> findTutorGroup(String college);
}
